package com.example.trb.config;

import com.example.trb.component.SecurityInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    SecurityInterceptor securityInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(securityInterceptor)
                // 设置拦截路径，我是全部拦截，根据自己项目配置
                .addPathPatterns("/**")
                // 设置不拦截的路径
                .excludePathPatterns(
                        "/user/login", "/user/register",
                        "/department/login"
                );
    }
}
